﻿@model ModalDownload.Models.ModelTable
@using ModalDownload.Models;
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width" />
    <title>资源发布</title>
    @Styles.Render("~/Content/admin/base.css")
    @Styles.Render("~/Content/admin/form.css")
    @Scripts.Render("~/bundles/jquery")
</head>
<body>
    <div>
        <script>
            $(function () {
                $('[name=type]').change(function () {
                    $.getJSON('/Admin/GetParentClass?mid=@(ViewBag.ID)', { type: $(this).val() },
                        function (data) {
                            $('[name=parent]').empty();
                            $.each(data, function (i, ie) {
                                var varItem = new Option(ie.Text, ie.Value,null,ie.Selected);
                                $('[name=parent]').append(varItem);
                            });
                            $('[name=parent]').change();
                        }
                    );
                });
                $('[name=parent]').change(function () {
                    $.getJSON('/Admin/GetChildClass?mid=@(ViewBag.ID)', { id: $(this).val() },
                        function (data) {
                            $('[name=child]').empty();
                            $.each(data, function (i, ie) {
                                var varItem = new Option(ie.Text, ie.Value, null, ie.Selected);
                                $('[name=child]').append(varItem);
                            });
                        }
                    );
                });
            });
            $(document).ready(function () {
                $.getJSON('/Admin/GetAllTypes?mid=@(ViewBag.ID)', { type: $(this).val() },
                        function (data) {
                            $('[name=type]').empty();
                            $.each(data, function (i, ie) {
                                var varItem = new Option(ie.Text, ie.Value, null, ie.Selected);
                                $('[name=type]').append(varItem);
                            });
                            $('[name=type]').change();
                        }
                    );
            });
        </script>
        @using (Html.BeginForm("Publish", "Admin", new { viewmode=ViewBag.ViewMode }, FormMethod.Post, new { name = "PublishForm", enctype = "multipart/form-data" }))
        {
            @Html.AntiForgeryToken()
            @Html.ValidationSummary(true)
            <table id="tableList" class="editForm" cellpadding="0" cellspacing="0">
                <tr>
                    <td style="width:10%"></td>
                    <td style="width:30%"></td>
                    <td style="width:30%"></td>
                    <td style="width:30%"></td>
                </tr>
                <tr>
                    <td align="center" style="font-size:22px;" colspan="4">资源信息</td>
                </tr>
                <tr>
                    <td class="fieldLable">@Html.LabelForModel("分类")</td>
                    <td class="fieldLable"><select id="type" name="type"></select></td>
                    <td class="fieldLable"><select id="parent" name="parent"></select></td>
                    <td class="fieldLable"><select id="child" name="child"></select></td>
                </tr>
                <tr>
                    <td class="fieldLable">@Html.LabelForModel("标题")</td>
                    <td class="fieldLable" colspan="3">@Html.TextBoxFor(m => m.title, new { style = "width:90%" })</td>
                </tr>
                <tr>
                    <td class="fieldLable">@Html.LabelForModel("内容")</td>
                    <td class="fieldLable" colspan="3">@Html.TextAreaFor(m => m.descirption, new { rows = "8", style = "width:90%" })</td>
                </tr>
                <tr>
                    <td class="fieldLable">@Html.LabelForModel("下载地址")</td>
                    <td class="fieldLable" colspan="3">@Html.TextBoxFor(m => m.download, new { style = "width:90%" })</td>
                </tr>
                <tr>
                    <td class="fieldLable">@Html.LabelForModel("推荐")</td>
                    <td class="fieldLable" colspan="3">@Html.CheckBoxFor(m => m.recommend,null)</td>
                </tr>
                <tr>
                    <td class="fieldLable">@Html.LabelForModel("热门")</td>
                    <td class="fieldLable" colspan="3">@Html.CheckBoxFor(m => m.hot,null)</td>
                </tr>
                <tr>
                    <td class="fieldLable" colspan="4"><input type="file" id="fileImage" name="fileImage" accept="image/*" /></td>
                </tr>
                <tr>
                    <td class="fieldLable" colspan="4"><input class="btn-" name="Submit1" type="submit" value="保存" /></td>
                </tr>
            </table>
        }
    </div>
</body>
</html>
